From 0b9e7a5d2901cb5e52a0f815aba3b7f7c1936e28 Mon Sep 17 00:00:00 2001 From: Jason Rumney Date: Fri, 1 Dec 2000 20:06:39 +0000 Subject: [PATCH] (get_frame_dc): Avoid changing the palette on an invalid frame. --- src/w32xfns.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/w32xfns.c b/src/w32xfns.c index 9624e0dd4eb..018aefdf35e 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -117,7 +117,11 @@ get_frame_dc (FRAME_PTR f) enter_crit (); hdc = GetDC (f->output_data.w32->window_desc); - select_palette (f, hdc); + + /* If this gets called during startup before the frame is valid, + there is a chance of corrupting random data or crashing. */ + if (hdc) + select_palette (f, hdc); return hdc; } -- 2.30.2